package dl.bukkit.myststus.function.trigger.imp;

import dl.bukkit.myststus.api.event.PlayerHealthEvent;
import dl.bukkit.myststus.configuration.imp.Config;
import dl.bukkit.myststus.library.ats.GComponent;
import dl.bukkit.myststus.function.trigger.TriggerHud;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;

@GComponent(
        key = "health",
        author = "DogLong"
)
public class HealthTrigger extends TriggerHud<PlayerHealthEvent> {
    @Override
    public boolean isRemove(PlayerHealthEvent event) {
        return getPlayer(event).isDead();
    }

    @Override
    public Class<PlayerHealthEvent> getEvent() {
        return PlayerHealthEvent.class;
    }

    @Override
    public Player getPlayer(PlayerHealthEvent event) {
        return event.getPlayer();
    }

    @Override
    public Entity getTarget(PlayerHealthEvent event) {
        return event.getPlayer();
    }

    @Override
    public boolean isRegister() {
        return Config.getInst().getBoolean("Trigger.Health");
    }
}
